/*
 * lib2Desa - Another 2D game library in C++
 * Copyright (C) 2009 Erivaldo Xavier de Lima Filho
 *
 * This program is free software and is distributed under GNU General Public License version 3. You can modify and/or redistribute
 * it under the terms of GPL version 3 or posterior version. This program comes with NO WARRANTY, for more details, see LICENSE,
 * or <http://www.gnu.org/licenses>.
 *
 * Contact info:
 *
 *	Erivaldo Xavier de Lima Filho, desadoc@gmail.com
 *
 */

#ifndef _KEYMESSAGE_HPP
#define _KEYMESSAGE_HPP

#include "Core/IMessage.hpp"

#include <vector>

#ifndef _NO_NAMESPACE
namespace lib2Desa {
#endif

class KeyMessage : public IMessage
{

public:

	enum KMT_TYPE
	{
		KMT_KEYDOWN,
		KMT_KEYUP,
	};

	enum KMK_KEY
	{
		KMK_UNKNOWN		= 0,
		KMK_FIRST		= 0,
		KMK_BACKSPACE	= 8,
		KMK_TAB			= 9,
		KMK_CLEAR		= 12,
		KMK_RETURN		= 13,
		KMK_PAUSE		= 19,
		KMK_ESCAPE		= 27,
		KMK_SPACE		= 32,
		KMK_EXCLAIM		= 33,
		KMK_QUOTEDBL	= 34,
		KMK_HASH		= 35,
		KMK_DOLLAR		= 36,
		KMK_AMPERSAND	= 38,
		KMK_QUOTE		= 39,
		KMK_LEFTPAREN	= 40,
		KMK_RIGHTPAREN	= 41,
		KMK_ASTERISK	= 42,
		KMK_PLUS		= 43,
		KMK_COMMA		= 44,
		KMK_MINUS		= 45,
		KMK_PERIOD		= 46,
		KMK_SLASH		= 47,
		KMK_0			= 48,
		KMK_1			= 49,
		KMK_2			= 50,
		KMK_3			= 51,
		KMK_4			= 52,
		KMK_5			= 53,
		KMK_6			= 54,
		KMK_7			= 55,
		KMK_8			= 56,
		KMK_9			= 57,
		KMK_COLON		= 58,
		KMK_SEMICOLON	= 59,
		KMK_LESS		= 60,
		KMK_EQUALS		= 61,
		KMK_GREATER		= 62,
		KMK_QUESTION	= 63,
		KMK_AT			= 64,
	/*
	   Skip uppercase letters
	 */
		KMK_LEFTBRACKET	= 91,
		KMK_BACKSLASH	= 92,
		KMK_RIGHTBRACKET= 93,
		KMK_CARET		= 94,
		KMK_UNDERSCORE	= 95,
		KMK_BACKQUOTE	= 96,
		KMK_a			= 97,
		KMK_b			= 98,
		KMK_c			= 99,
		KMK_d			= 100,
		KMK_e			= 101,
		KMK_f			= 102,
		KMK_g			= 103,
		KMK_h			= 104,
		KMK_i			= 105,
		KMK_j			= 106,
		KMK_k			= 107,
		KMK_l			= 108,
		KMK_m			= 109,
		KMK_n			= 110,
		KMK_o			= 111,
		KMK_p			= 112,
		KMK_q			= 113,
		KMK_r			= 114,
		KMK_s			= 115,
		KMK_t			= 116,
		KMK_u			= 117,
		KMK_v			= 118,
		KMK_w			= 119,
		KMK_x			= 120,
		KMK_y			= 121,
		KMK_z			= 122,
		KMK_DELETE		= 127,
	/* End of ASCII mapped keysyms */

	/* International keyboard syms */
		KMK_WORLD_0		= 160,		/* 0xA0 */
		KMK_WORLD_1		= 161,
		KMK_WORLD_2		= 162,
		KMK_WORLD_3		= 163,
		KMK_WORLD_4		= 164,
		KMK_WORLD_5		= 165,
		KMK_WORLD_6		= 166,
		KMK_WORLD_7		= 167,
		KMK_WORLD_8		= 168,
		KMK_WORLD_9		= 169,
		KMK_WORLD_10	= 170,
		KMK_WORLD_11	= 171,
		KMK_WORLD_12	= 172,
		KMK_WORLD_13	= 173,
		KMK_WORLD_14	= 174,
		KMK_WORLD_15	= 175,
		KMK_WORLD_16	= 176,
		KMK_WORLD_17	= 177,
		KMK_WORLD_18	= 178,
		KMK_WORLD_19	= 179,
		KMK_WORLD_20	= 180,
		KMK_WORLD_21	= 181,
		KMK_WORLD_22	= 182,
		KMK_WORLD_23	= 183,
		KMK_WORLD_24	= 184,
		KMK_WORLD_25	= 185,
		KMK_WORLD_26	= 186,
		KMK_WORLD_27	= 187,
		KMK_WORLD_28	= 188,
		KMK_WORLD_29	= 189,
		KMK_WORLD_30	= 190,
		KMK_WORLD_31	= 191,
		KMK_WORLD_32	= 192,
		KMK_WORLD_33	= 193,
		KMK_WORLD_34	= 194,
		KMK_WORLD_35	= 195,
		KMK_WORLD_36	= 196,
		KMK_WORLD_37	= 197,
		KMK_WORLD_38	= 198,
		KMK_WORLD_39	= 199,
		KMK_WORLD_40	= 200,
		KMK_WORLD_41	= 201,
		KMK_WORLD_42	= 202,
		KMK_WORLD_43	= 203,
		KMK_WORLD_44	= 204,
		KMK_WORLD_45	= 205,
		KMK_WORLD_46	= 206,
		KMK_WORLD_47	= 207,
		KMK_WORLD_48	= 208,
		KMK_WORLD_49	= 209,
		KMK_WORLD_50	= 210,
		KMK_WORLD_51	= 211,
		KMK_WORLD_52	= 212,
		KMK_WORLD_53	= 213,
		KMK_WORLD_54	= 214,
		KMK_WORLD_55	= 215,
		KMK_WORLD_56	= 216,
		KMK_WORLD_57	= 217,
		KMK_WORLD_58	= 218,
		KMK_WORLD_59	= 219,
		KMK_WORLD_60	= 220,
		KMK_WORLD_61	= 221,
		KMK_WORLD_62	= 222,
		KMK_WORLD_63	= 223,
		KMK_WORLD_64	= 224,
		KMK_WORLD_65	= 225,
		KMK_WORLD_66	= 226,
		KMK_WORLD_67	= 227,
		KMK_WORLD_68	= 228,
		KMK_WORLD_69	= 229,
		KMK_WORLD_70	= 230,
		KMK_WORLD_71	= 231,
		KMK_WORLD_72	= 232,
		KMK_WORLD_73	= 233,
		KMK_WORLD_74	= 234,
		KMK_WORLD_75	= 235,
		KMK_WORLD_76	= 236,
		KMK_WORLD_77	= 237,
		KMK_WORLD_78	= 238,
		KMK_WORLD_79	= 239,
		KMK_WORLD_80	= 240,
		KMK_WORLD_81	= 241,
		KMK_WORLD_82	= 242,
		KMK_WORLD_83	= 243,
		KMK_WORLD_84	= 244,
		KMK_WORLD_85	= 245,
		KMK_WORLD_86	= 246,
		KMK_WORLD_87	= 247,
		KMK_WORLD_88	= 248,
		KMK_WORLD_89	= 249,
		KMK_WORLD_90	= 250,
		KMK_WORLD_91	= 251,
		KMK_WORLD_92	= 252,
		KMK_WORLD_93	= 253,
		KMK_WORLD_94	= 254,
		KMK_WORLD_95	= 255,		/* 0xFF */

	/* Numeric keypad */
		KMK_KP0			= 256,
		KMK_KP1			= 257,
		KMK_KP2			= 258,
		KMK_KP3			= 259,
		KMK_KP4			= 260,
		KMK_KP5			= 261,
		KMK_KP6			= 262,
		KMK_KP7			= 263,
		KMK_KP8			= 264,
		KMK_KP9			= 265,
		KMK_KP_PERIOD	= 266,
		KMK_KP_DIVIDE	= 267,
		KMK_KP_MULTIPLY	= 268,
		KMK_KP_MINUS	= 269,
		KMK_KP_PLUS		= 270,
		KMK_KP_ENTER	= 271,
		KMK_KP_EQUALS	= 272,

	/* Arrows + Home/End pad */
		KMK_UP			= 273,
		KMK_DOWN		= 274,
		KMK_RIGHT		= 275,
		KMK_LEFT		= 276,
		KMK_INSERT		= 277,
		KMK_HOME		= 278,
		KMK_END			= 279,
		KMK_PAGEUP		= 280,
		KMK_PAGEDOWN	= 281,

	/* Function keys */
		KMK_F1			= 282,
		KMK_F2			= 283,
		KMK_F3			= 284,
		KMK_F4			= 285,
		KMK_F5			= 286,
		KMK_F6			= 287,
		KMK_F7			= 288,
		KMK_F8			= 289,
		KMK_F9			= 290,
		KMK_F10			= 291,
		KMK_F11			= 292,
		KMK_F12			= 293,
		KMK_F13			= 294,
		KMK_F14			= 295,
		KMK_F15			= 296,

	/* Key state modifier keys */
		KMK_NUMLOCK		= 300,
		KMK_CAPSLOCK	= 301,
		KMK_SCROLLOCK	= 302,
		KMK_RSHIFT		= 303,
		KMK_LSHIFT		= 304,
		KMK_RCTRL		= 305,
		KMK_LCTRL		= 306,
		KMK_RALT		= 307,
		KMK_LALT		= 308,
		KMK_RMETA		= 309,
		KMK_LMETA		= 310,
		KMK_LSUPER		= 311,		/* Left "Windows" key */
		KMK_RSUPER		= 312,		/* Right "Windows" key */
		KMK_MODE		= 313,		/* "Alt Gr" key */
		KMK_COMPOSE		= 314,		/* Multi-key compose key */

	/* Miscellaneous function keys */
		KMK_HELP		= 315,
		KMK_PRINT		= 316,
		KMK_SYSREQ		= 317,
		KMK_BREAK		= 318,
		KMK_MENU		= 319,
		KMK_POWER		= 320,		/* Power Macintosh power key */
		KMK_EURO		= 321,		/* Some european keyboards */
		KMK_UNDO		= 322,		/* Atari keyboard has Undo */

	/* Add any other keys here */

		KMK_LAST
	};

private:

	const KMT_TYPE type;
	const KMK_KEY key;

public:

	KeyMessage(KMT_TYPE t, KMK_KEY k)
	: type(t), key(k)
	{
	}

	IEvent::EVENT_TYPE getEventType(void) const
	{
		return IEvent::ET_KEY;
	}

	KMT_TYPE getType(void) const
	{
		return type;
	}

	KMK_KEY getKey(void) const
	{
		return key;
	}
};

#ifndef _NO_NAMESPACE
}
#endif

#endif /*KeyMessage.hpp included*/
